package com.foreknow.demo11;

import java.util.*;

public class Demo {
    public static void main(String[] args) {
        Map<Integer,Person> map1 = new HashMap<>();
        Person mp1 = new Person();
        mp1.setName("tom");
        Person mp2 = new Person();
        mp2.setName("fender");
        map1.put(1,mp1);
        map1.put(2,mp2);
        Map<Integer,Person> map2 = new HashMap<>();
        Person mp3 = new Person();
        mp3.setName("qqq");
        Person mp4 = new Person();
        mp4.setName("www");
        map2.put(1,mp3);
        map2.put(2,mp4);
        Map<Integer,Person> map3 = new HashMap<>();
        Person mp5 = new Person();
        mp5.setName("eee");
        Person mp6 = new Person();
        mp6.setName("rrr");
        map3.put(1,mp5);
        map3.put(2,mp6);
        List<Map> list = new ArrayList<>();
        list.add(map1);
        list.add(map2);
        list.add(map3);
        for (Map<Integer,Person> a:list) {
            Set<Map.Entry<Integer,Person>>  s = a.entrySet();
            Iterator<Map.Entry<Integer,Person>> iterator= s.iterator();
            while (iterator.hasNext()){
                Map.Entry entry = iterator.next();
                Integer key = (Integer) entry.getKey();
                Person values = (Person) entry.getValue();
                System.out.println(key+"---"+values.getName());
            }
        }
    }
}
